import { BookItem } from '../types/book'
import { http } from '@/utils/http'

/**
 *
 * @returns 书架中收藏的书籍
 */
export const listBookShelfAPI = () => {
	return http<BookItem[]>({
		url: '/fanqie/bookShelf/listBookShelf',
		method: 'GET',
	})
}

/**
 * 添加书籍到书架
 * @param bookId 书籍id
 * @returns 
 */
export const addBookShelfAPI = (bookId : number) => {
	return http({
		url: '/fanqie/bookShelf/addBookShelf',
		method: 'GET',
		data: {
			bookId
		}
	})
}

/**
 * 查看当前书籍是否在书架上
 * @param bookId 书籍id
 * @returns 
 */
export const getBookShelfByIdAPI = (bookId : number) => {
	return http({
		url: '/fanqie/bookShelf/getBookShelfById',
		method: 'GET',
		data: {
			bookId
		}
	})
}